package com.dobbinsoft.iotechn.data.config.vod;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import com.dobbinsoft.iotechn.data.client.AliyunVideoClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author kbq
 * @ClassName: VodConfig
 * @Description:
 * @date 20-3-26下午3:40
 */

@Configuration
public class VodConfig {

    @Value("${vod.aliyun.vod.accessId}")
    private String accessKeyId ;
    @Value("${vod.aliyun.vod.accessKey}")
    private String accessKeySecret;
    @Value("${vod.aliyun.vod.regionId}")
    private String regionId; // 点播服务接入区域



    @Bean
    public DefaultAcsClient defaultAcsClient(){
        DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
        return new DefaultAcsClient(profile);
    }

    @Bean
    public AliyunVideoClient videoClient() {
        AliyunVideoClient aliyunVideoClient = new AliyunVideoClient();
        aliyunVideoClient.setAccessKeyId(accessKeyId);
        aliyunVideoClient.setAccessKeySecret(accessKeySecret);
        aliyunVideoClient.setRegionId(regionId);
        return aliyunVideoClient;
    }
}
